<template>
<div id="test">
  {{ abc }}
</div>
</template>

<script>
export default {
  data(){
    return{
      abc:[
        {
comment_num:1,
create_time:"2022-02-25T23:14:17.101",
id:51,
like_num:0,
read_num:15,
},
                  {
comment_num:3,
create_time:"2022-02-25T23:14:17.101",
id:10,
like_num:0,
read_num:18,
},
                  {
comment_num:2,
create_time:"2022-02-25T23:14:17.101",
id:9,
like_num:8,
read_num:23,
},
                  {
comment_num:6,
create_time:"2022-02-25T23:14:17.101",
id:9,
like_num:7,
read_num:13,
},
      ]
    }
  },
name: "test",

  methods:{


compare(prop) {
    return function (obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];if (val1 < val2) {
            return -1;
        } else if (val1 > val2) {
            return 1;
        } else {
            return 0;
        }
    }
}

  },
  created() {
    this.abc.sort(this.compare('read_num'))
  }
}
</script>

<style scoped>

</style>